using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Travel
{
    public partial class Booking : Form
    {
        private Travel.UserControls.PointHistory ucPointHistory = new Travel.UserControls.PointHistory();
        private Travel.UserControls.PointPurchase ucPointPurchase = new Travel.UserControls.PointPurchase();
        private Travel.Customize objCustomize = null;
        private Travel.Rate objRate = null;
        public Booking()
        {
            InitializeComponent();
        }       

        //private void gvPoint_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        //{
        //    if (e.ColumnIndex == colProcess.Index)
        //    {
        //        if (e.RowIndex == 0)
        //        {
        //            e.Graphics.FillRectangle(new SolidBrush(Color.White), e.CellBounds.X, e.CellBounds.Y, e.CellBounds.Width-2, e.CellBounds.Height-2);
        //            e.Handled = true;
        //        }
        //    }
        //}

        //private void DataPoint()
        //{
        //    gvPoint.Rows.Add("2009", "7000", "0", "6900", "180", null);
        //    gvPoint.Rows.Add("2010", "7000", "9000", "0", "7000", "Maintain");
        //    gvPoint.Rows.Add("2011", "7000", "0", "0", "0", "Maintain");
        //}

        private void DataPurchase()
        {
            //gvPurcharse.Rows.Add("01/01/2008", "500");
            //gvPurcharse.Rows.Add("01/02/2008", "1000");
            //gvPurcharse.Rows.Add("01/03/2008", "1500");
            //gvPurcharse.Rows.Add("01/04/2008", "2000");
        }

        private void DataGuest()
        {
            gvGuest.Rows.Add("Truong Cao Hong Van","Remove");
            gvGuest.Rows.Add("Tong Kim Nhat Thanh", "Remove");
            gvGuest.Rows.Add("Vo Ta Nhu", "Remove");
        }

        private void DataAddOns()
        {
            gvAddOns.Rows.Add("Go to pub", "5,000","Remove");
            gvAddOns.Rows.Add("Go to bar", "3,000", "Remove");
            gvAddOns.Rows.Add("Go to restaurant", "2,500", "Remove");
        }

        private void DataRevenue()
        {
            gvRevenue.Rows.Add("Food","");
            gvRevenue.Rows.Add("Beverage","");
            gvRevenue.Rows.Add("Spa","");
            gvRevenue.Rows.Add("Excursion","");
        }

        private void Booking_Load(object sender, EventArgs e)
        {
            //DataPoint();
            DataPurchase();
            DataGuest();
            DataAddOns();
            tabControl1_SelectedIndexChanged(sender, e);
            rbResort.Checked = true;
            gbService.Visible = false;
            //this.gvPoint.Columns["colYear"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            //this.gvPoint.Columns["colInit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            //this.gvPoint.Columns["colPurchase"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            //this.gvPoint.Columns["colUsed"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            //this.gvPoint.Columns["colRemanining"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            tabControl1.TabPages["tabPointPurchase"].Controls.Add(ucPointPurchase);
            DataRevenue();
        }

        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 0)
            {
                panel2.Controls.Add(ucPointHistory);
                pictureBox1.Show();
            }
            else
            {
                pictureBox1.Hide();
            }            
        }

        private void label23_Click(object sender, EventArgs e)
        {

        }

        private void textBox8_TextChanged(object sender, EventArgs e)
        {

        }

        private void rbResort_CheckedChanged(object sender, EventArgs e)
        {
            if (rbResort.Checked == true)
            {
                gbResort.Visible = true;
            }
            else
            {
                gbResort.Visible = false;
            }
        }

        private void rbService_CheckedChanged(object sender, EventArgs e)
        {
            if (rbService.Checked == true)
            {
                gbService.Visible = true;
                gbResort.Visible = false;
            }
            else
            {
                gbService.Visible = false;
                gbResort.Visible = true;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if(objRate == null)
            {
                objRate = new Rate();
            }
            objRate.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (objCustomize == null)
            {
                objCustomize = new Customize();
            }
            objCustomize.Show();
        }
    }
}